package com.zkthink.ceres.finance.dao;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.zkthink.base.mapper.SuperMapper;
import com.zkthink.ceres.finance.dto.CashOutAuditDTO;
import com.zkthink.ceres.finance.entity.CashOutDetail;

import com.zkthink.ceres.finance.vo.CashOutDetailVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * 提现明细表
 * </p>
 *
 * @author vivi.huang
 * @date 2020-05-25
 */
@Repository
public interface CashOutDetailMapper extends SuperMapper<CashOutDetail> {

    /**
     * 提现明细分页total
     * @param startTime
     * @param endTime
     * @return
     */
    Integer getTotalOfCashOutDetailPage(@Param("startTime") String startTime, @Param("endTime")String endTime);

    /**
     * 提现明细list
     * @param startTime
     * @param endTime
     * @param page
     * @param size
     * @return
     */
    List<CashOutDetailVO> findCashOutDetailPage(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("page")long page, @Param("size")long size);

    /**
     * 提现审核分页 total
     * @param storeName
     * @param tenant
     * @param applyTimeString
     * @param auditStatus
     * @return
     */
    @SqlParser(filter = true)
    Integer getTotalOfAuditCashOutDetailPage(@Param("storeName")String storeName, @Param("tenant")String tenant, @Param("applyTimeString")String applyTimeString, @Param("auditStatus")Integer auditStatus);

    /**
     * 提现审核分页 list
     * @param storeName
     * @param tenant
     * @param applyTimeString
     * @param auditStatus
     * @param page
     * @param size
     * @return
     */
    @SqlParser(filter = true)
    List<CashOutAuditDTO> findAuditCashOutDetailPage(@Param("storeName")String storeName, @Param("tenant")String tenant, @Param("applyTimeString")String applyTimeString, @Param("auditStatus")Integer auditStatus, @Param("page") long page, @Param("size")long size);

    /**
     * 获取提现审核
     * @param id
     * @return
     */
    @SqlParser(filter = true)
    CashOutAuditDTO getCashOutAudit(@Param("id") Long id);

    /**
     * 更新提现申请 审核通过状态
     * @param id
     */
    @SqlParser(filter = true)
    void updateAuditSuccess(@Param("id") Long id);

    /**
     * 查询提现明细
     * @param id
     * @return
     */
    @SqlParser(filter = true)
    CashOutDetail getCashOutDetail(@Param("id") Long id);

    /**
     * 查询提现中金额
     * @return
     */
    Long getCashOutApplyMoney();
}
